//
//  UITextViewPlaceholderViewController.m
//  YBTool
//
//  Created by 陈亚勃 on 16/1/21.
//  Copyright © 2016年 cyb. All rights reserved.
//

#import "UITextViewPlaceholderViewController.h"

@interface UITextViewPlaceholderViewController ()<UITextViewDelegate,UITextFieldDelegate>

@end

@implementation UITextViewPlaceholderViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.equalTo(@10);
        make.right.equalTo(@-10);
        make.height.equalTo(@300);
    }];
    self.textView.text = @"hahaha";
    self.textView.placeholder = @"This is placeholder";
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{
    if ([text isEqualToString:@"\n"]) {
        NSLog(@"return");
        [self.view endEditing:YES];
    }
    return YES;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
